package p.ithorns.sample.websocket.core;

import org.springframework.stereotype.Component;
import p.ithorns.framework.core.message.MsgListener;
import p.ithorns.framework.redis.stream.RedisStreamListener;
import p.ithorns.framework.redis.stream.RedisStreamTemplate;
import p.ithorns.sample.websocket.model.WsUpMsg;

/**
 * WsMsgListener
 *
 * @author HtL
 * @date 2024/10/17 11:31
 * @since 1.0.0
 */
@Component
public class WsMsgListener extends RedisStreamListener<WsUpMsg<?>> {

    @Override
    public void onMessage(WsUpMsg<?> msg) {
        String clientId = msg.getClientId();
        ChannelSupervise.send(clientId, msg.getData());
    }

    @Override
    public String getStream() {
        return "DT";
    }

}